from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Edge()
driver.get("http://news.baidu.com/")

# 通过id属性定位元素
element = driver.find_element(By.ID, 'header-wrapper')
print(element.text)

# 通过class属性定位元素
driver.get("https://movie.douban.com/subject/10604086/comments?status=P")
element = driver.find_element(By.CLASS_NAME, 'short')
print(element.text)
